Content starts here Check Namespaces in Return Types
This page last changed on Mar 11, 2008.

eDocs Home > BEA AquaLogic Data Services Platform Documentation > Data Services Developer's Guide > Contents

How To Check Namespaces in Return Types

This topic shows you how to make sure the namespaces used in your return type are correct.

Check Prefix Bindings

In the return type, a child element must be in the same namespace as its parent. If a return type uses elements in different namespaces, you cannot deploy the logical data service to the server or test it from Studio.

The exception to this rule is when the parent and child are in different namespaces, but both namespaces have the same prefix binding. Check prefix bindings first, and then edit the namespace, if needed.

To check prefix bindings in the Overview tab:

  1. Click the Overview tab.
  2. Click the Properties tab (if it's not visible, choose Window > Show View > Properties).
     

To check prefix bindings in Source:

  1. Click the Source tab.
  2. Look for the XQuery namespace statements:
    import schema namespace myc="ld:logical/MyCustomer" at "ld:logical/schemas/MyCustomer.xsd";
    declare namespace cus= "ld:physical/CUSTOMER";
    import schema namespace myc1="ld:logical/MyCustomer" at "ld:logical/schemas/MyCustomer_KEY.xsd";

In both these examples, the myc and myc1 namespaces have the same prefix binding. You can have a parent element in one and a child element in another. But if you have a parent element in myc and a child in cus, you need to change one namespace in the return type.

Edit the Namespace

Once you check the prefix binding, you can check a namespace used in a return type and change it in the Query Map or Source view.

To edit a namespace in Query Map view:

  1. Click the Query Map tab.
  2. Select the parent element in the return type, then click it.
    Be sure to select and then click; do not double-click.
     

  3. Select the child element in the return type, then click it.
  4. If the child element is in a different namespace, change it to the namespace of the parent.
  5. Right-click the title bar of the return type, and choose Save and Associate XML Type.
     

  6. Enter the correct location, namespace, and root element name for the return type. Click OK.

To edit a namespace in Source view:

  1. Click the Source tab.
  2. Expand the primary Read function:
     

     
  3. Locate the namespace of the child element and change it to the namespace of the parent, both in the start and end elements:
    declare function myc:read() as element(myc:CUSTOMER)*{
    for $CUSTOMER in cus:CUSTOMER()
    return
        <myc:CUSTOMER>
        ...
       {
            for $ADDRESS in add:ADDRESS()
            where $CUSTOMER/CUSTOMER_ID eq $ADDRESS/CUSTOMER_ID
            return
            <myc:ADDRESS >
            ...
            </myc:ADDRESS>
       }
  4. Save the changes.

See Also

How To
Other Resources



Document generated by Confluence on Apr 28, 2008 15:54